package cn.cuilan.secondkill.task;

import cn.cuilan.secondkill.redis.RedisMonitor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

@Component
public class RedisMonitorTask {

    private RedisMonitor redisMonitor;

    @Autowired
    public RedisMonitorTask(RedisMonitor redisMonitor) {
        this.redisMonitor = redisMonitor;
    }

    // 每2分钟执行一次
    @Scheduled(cron = "0 0/2 * * * ?")
    public void monitorRedis() {
        redisMonitor.monitorRedis("secondKill");
    }
}
